//2009/08/10 20:02:40
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class PassingGrade
{
public:
    int pointsNeeded(vector <int> Earned, vector <int> Possible, int finalExam)
    {
		int got = 0;
		int total = finalExam;
		for(int i=0; i<Possible.size(); i++)
		{
			got += Earned[i];
			total += Possible[i];
		}
		int need = (total * 65 - 1)/ 100 + 1 - got;
		if(need <= finalExam)
		{
			if(need <= 0) return 0;
			return need;
		}
		return -1;
    }
};
